package whf.framework.web.tag.ext;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.JspException;

import whf.framework.util.Output;

/**
 * @author wanghaifeng
 *
 */
public class FormDisplayDecorator implements IDisplayDecorator {
	
	public void println(Object text){
		
	}
	public void print(Object text){
		
	}
	public void display(HttpServletRequest request, HttpServletResponse response, Output output) throws JspException, IOException {
//		ValidateErrors errors = (ValidateErrors)request.getAttribute(Constants.VALIDATE_ERRORS);
//		//begin write form
//		for (Iterator<TableRow> rows = this.tableModel.getRows().iterator(); rows.hasNext();) {
//			println(super.getOpenTag("table"));
//			println("<tbody>");
//			String trClass ="odd";
//			TableRow row = rows.next();
//			for (Iterator<TableColumn> columnIterator = this.tableModel.getColumns().iterator(); columnIterator.hasNext();) {
//				TableColumn col = columnIterator.next();
//				String requiredText = "";
//				if(col.isRequired() && this.editable){
//					requiredText = "<font color='red'>*</font>";
//				} else {
//					requiredText = "";
//				}
//				println("<tr class='"+trClass+"'>");
//				String displayValue = this.getCellContent(row, col);
//				println("<td").print(col.getHtmlAttributes()).print(">");
//				print(col.getDisplayTitle()).print(requiredText).print("</td>");
//				print("<td width='"+this.displayCellWidth+"'>").print(displayValue).print("</td>");
//				//
//				int columnCount = 1;
//				while(columnCount < this.displayColumnCount && columnIterator.hasNext()){
//					col = columnIterator.next();
//					if(col.isRequired()){
//						requiredText = "<font color='red'>*</font>";
//					} else {
//						requiredText = "";
//					}
//					displayValue = this.getCellContent(row, col);
//					print("<td").print(col.getHtmlAttributes()).print(">");
//					print(col.getDisplayTitle()).print(requiredText).print("</td>");
//					print("<td width='"+this.displayCellWidth+"' >").print(displayValue).print("</td>");
//					columnCount++;
//				}
//				//
//				println("</tr>");
//			}
//			trClass = StringUtils.equalsIgnoreCase(trClass,"odd")?"even":"odd";
//			println("</tbody>");
//			println("</table>");
//		}
//		// end write form;
//		if (this.navPosition == NavPosition.BOTTOM || this.navPosition == NavPosition.BOTH) {
//			this.outputNav();
//		}
//		this.outputFooter();
	}

}
